﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FantasyBlog.DAL;

namespace FantasyBlog.BLL
{
    public class CommentsProvider:ICommentProvider
    {
        public IQueryable<DAL.Comment> GetSonsComments(int Id)
        {
            var comments = (from c in Model.CommentSet
                            where c.Parent.ID == Id
                            orderby c.date
                            select c);
            return comments;
        }

        public IQueryable<DAL.Comment> GetPostComments(int Id)
        {
            var comments = (from c in Model.CommentSet
                            where c.Post.ID == Id 
                            orderby c.date
                            select c);
            return comments;
        }

        public IQueryable<DAL.Comment> GetUserComments(string username)
        {
            var comments = (from c in Model.CommentSet
                            where c.User.username == username
                            orderby c.date
                            select c);
            return comments;
        }
        BlogModelContainer Model = new BlogModelContainer();
    }
}
